﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class TableMaster : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["editRecord"] != null)
                btnAdd.Text = "Edit";
            makeTabSelected();
        }
    }

    private void makeTabSelected()
    {
        //li1.Attributes.Remove("class");
        //li2.Attributes.Remove("class");

        //if (Request.Url.ToString().Contains(a1.HRef.Replace("~/", "")))
        //{
        //    li1.Attributes.Add("class", "active");
        //    li2.Attributes.Add("class", "");
        //}
        //else
        //{
        //    li2.Attributes.Add("class", "active");
        //    li1.Attributes.Add("class", "");
        //}
    }

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string btnText = "";
        btnText = ((LinkButton)sender).Text;
        if (btnText == "List")
        {
            pnlAdd.Visible = false;
            pnlGrid.Visible = true;
            li1.Attributes.Add("class","active");
            li2.Attributes.Add("class", "");
            this.Page.DataBind();
        }
        else
        {
            pnlAdd.Visible = true;
            pnlGrid.Visible = false;
            li1.Attributes.Add("class", "");
            li2.Attributes.Add("class", "active");
        }
    }

}
